<template>
    <!--    light-->
    <el-tooltip :disabled="!disabled||hasTooltipContent()" class="item" effect="dark" :content="tooltipContent" placement="top">
        <template slot="content">
            <slot name="abtContent"></slot>
        </template>
        <div>
            <el-button
                :size="size"
                :type="type"
                :icon="icon"
                :nativeType="nativeType"
                :loading="loading"
                :disabled="disabled"
                :plain="plain"
                :autofocus="autofocus"
                :round="round"
                :circle="circle"
                @click="handleClickBefore"
            >
                <slot></slot>
            </el-button>
        </div>
    </el-tooltip>
</template>

<script>
import {isNullOrUndefined, strIsEmpty} from "../../../core";

export default {
    inject: {
        elForm: {
            default: ''
        },
        elFormItem: {
            default: ''
        }
    },
    name: "SksButtonTooltip",
    props:{
        //1: 点击行中任何位置,行底色变化之后才能点击
        //1: 勾选表中最左边列的勾选框后才能点击
        tooltipContent: String,
        type: String,
        size: {
            type: String,
            //'small'
            default: undefined,
        },
        icon: String,
        nativeType: String,
        loading: Boolean,
        disabled: Boolean,
        // //true 不显示,用于 slot插槽时控制显示不显示
        // disabledTooltip: Boolean,
        plain: Boolean,
        autofocus: Boolean,
        round: Boolean,
        circle: Boolean,

        //检查列表行对应的操作是否可点击
        //检查时的全局 domain
        // {
        //      //自定义的链接名称,可以为空
        //      aliasIn: 'urlAliasName',
        //      globalDomain: mainTable.currentRow,
        //         autumnServiceBeanNameList: [
        //             {
        //                 autumnServiceName: 'proPlanMain',
        //                 beanName: `checkWorkStatusCanUploadDrawing`,
        //                 //如果为空,则会使用 globalDomain 作为 domain
        //                 //domain: undefined,
        //             },
        //       ]
        // }
        clickBeforeAutumnServiceInRow: Object,
    },
    methods:{
        //点击前检查是否可操作
        handleClickBefore(e){
            if(isNullOrUndefined(this.clickBeforeCheckRemoteFunc)){
                this.emitClickIfConfirmMsg(e)
                return;
            }

            this.clickBeforeCheckRemoteFunc().then(res=>{
                this.emitClickIfConfirmMsg(e)
            })
        },
        hasTooltipContent(){
            return (strIsEmpty(this.tooltipContent)&&isNullOrUndefined(this.$slots.abtContent))
        },
    },
}
</script>

<style scoped>

</style>

<!--
                    <sks-button-tooltip
                        tooltip-content="1:非完成人员无法上传文件及完成，2:已完成,不能再做操作"
                        class="mb5"
                        type="primary"
                        :disabled="!safeGet(mainTable.currentRow,`${mainTable.uniqueId}`)||!equalsLoginUserId(safeGet(mainTable.currentRow,`assignItemUserId`))"
                        @click="showItemApprDrawing2dDialogRef(mainTable.currentRow)"
                        :allLoading.sync="allLoading"
                        :clickBeforeAutumnServiceInRow="{
                            //检查时的全局 domain
                            globalDomain: mainTable.currentRow,
                            //自定义的链接名称,可以为空
                            aliasIn: 'urlAliasName',
                            autumnServiceBeanNameList: [
                                {
                                    autumnServiceName: 'proPlanMain',
                                    //检查的 beanName
                                    beanName: `checkWorkStatusCanUploadDrawing`,
                                },
                            ]
                        }"
                        v-hasPermi="['order:itemAppr:button:001']"
                    > 二维图纸
                    </sks-button-tooltip>

-->

